package com.ruoyi.tea.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tea.mapper.TeaLeafMapper;
import com.ruoyi.tea.domain.TeaLeaf;
import com.ruoyi.tea.service.ITeaLeafService;

/**
 * 茶叶信息Service业务层处理
 * 
 * @author hmx
 * @date 2023-03-15
 */
@Service
public class TeaLeafServiceImpl implements ITeaLeafService 
{
    @Autowired
    private TeaLeafMapper teaLeafMapper;

    /**
     * 查询茶叶信息
     * 
     * @param leafId 茶叶信息主键
     * @return 茶叶信息
     */
    @Override
    public TeaLeaf selectTeaLeafByLeafId(Long leafId)
    {
        return teaLeafMapper.selectTeaLeafByLeafId(leafId);
    }

    /**
     * 查询茶叶信息列表
     * 
     * @param teaLeaf 茶叶信息
     * @return 茶叶信息
     */
    @Override
    public List<TeaLeaf> selectTeaLeafList(TeaLeaf teaLeaf)
    {
        return teaLeafMapper.selectTeaLeafList(teaLeaf);
    }

    /**
     * 新增茶叶信息
     * 
     * @param teaLeaf 茶叶信息
     * @return 结果
     */
    @Override
    public int insertTeaLeaf(TeaLeaf teaLeaf)
    {
        teaLeaf.setCreateTime(DateUtils.getNowDate());
        return teaLeafMapper.insertTeaLeaf(teaLeaf);
    }

    /**
     * 修改茶叶信息
     * 
     * @param teaLeaf 茶叶信息
     * @return 结果
     */
    @Override
    public int updateTeaLeaf(TeaLeaf teaLeaf)
    {
        teaLeaf.setUpdateTime(DateUtils.getNowDate());
        return teaLeafMapper.updateTeaLeaf(teaLeaf);
    }

    /**
     * 批量删除茶叶信息
     * 
     * @param leafIds 需要删除的茶叶信息主键
     * @return 结果
     */
    @Override
    public int deleteTeaLeafByLeafIds(Long[] leafIds)
    {
        return teaLeafMapper.deleteTeaLeafByLeafIds(leafIds);
    }

    /**
     * 删除茶叶信息信息
     * 
     * @param leafId 茶叶信息主键
     * @return 结果
     */
    @Override
    public int deleteTeaLeafByLeafId(Long leafId)
    {
        return teaLeafMapper.deleteTeaLeafByLeafId(leafId);
    }
}
